UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G4Z56/ICQg8UUpsf3Ra6GlqbNDPD2XBOglvxAP7Cnf4='
WHERE
key_id = '784476bc9b16f55f4f6dae3a4b0394b4c30e1f2753187bba5a99ddf0f42d6bf2'
AND (
token = 'G4Z56/ICQg8UUpsf3Ra6GlqbNDPD2XBOglvxAP7Cnf4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)