UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BCPxJFpqsdqDqr3G1Bou0C/TPKj/jk0kjWNe9ZnaX9w='
WHERE
key_id = 'a232dcf11225cb73c35c309794b36a6dd8abba284da71695fe8b145068d6ce55'
AND (
token = 'BCPxJFpqsdqDqr3G1Bou0C/TPKj/jk0kjWNe9ZnaX9w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)