UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Hc8RBc0gUAJZ2QRxz+3+ZRBK+7BykF1wa2X9cTJA2s='
WHERE
key_id = 'e8607b7c95fb57781e61f38ce7867d4f40a64d7beae397e3404aae01244562ec'
AND (
token = '6Hc8RBc0gUAJZ2QRxz+3+ZRBK+7BykF1wa2X9cTJA2s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)