UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RuaBn/lsKxFdkXf8x2t0GHE5aiTukqPeyEu03OzGJ3w='
WHERE
key_id = 'c2f425f934c392ef7ce2becffdd62041a0076f56521a8f8c041951d915c57e3d'
AND (
token = 'RuaBn/lsKxFdkXf8x2t0GHE5aiTukqPeyEu03OzGJ3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)