UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1062AE82Gvs2j6m4lCwFvseUFKK9TG37lF2F2iP2Ogg='
WHERE
key_id = '99b1cd265e52285574092e0c1847ddfa4a25dd6de33312fb2c54d0af56f44a09'
AND (
token = '1062AE82Gvs2j6m4lCwFvseUFKK9TG37lF2F2iP2Ogg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)