UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q8dWoVVooYsYN2A3ORnx72WmFIxYcH24qJB5feF/ZC4='
WHERE
key_id = '8c8fa38bd16021c370d4abebd7f4d3dd461dd4c238d78889a0c294abab91c479'
AND (
token = 'Q8dWoVVooYsYN2A3ORnx72WmFIxYcH24qJB5feF/ZC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)