UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P3Jdy3c95EBznn5LpplF9ELdYNAEGJaulqI/L6wMt/8='
WHERE
key_id = 'ed50aa0bdcdecad206217b4eb51c3596d21a35979700e93bf76c9f055ca5de06'
AND (
token = 'P3Jdy3c95EBznn5LpplF9ELdYNAEGJaulqI/L6wMt/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)