UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's4YiatHdkzB3rFGKLZiI5v2zhyUsyzFieX501G273gk='
WHERE
key_id = 'd84f9a0656c34bb96bb408a97999f3980a76e3df68de8fb3995d513f2af0421c'
AND (
token = 's4YiatHdkzB3rFGKLZiI5v2zhyUsyzFieX501G273gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)