UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fpLIS9pY0/pIubj4N2xvWz/6y07Hl1vinHwKpePc9hE='
WHERE
key_id = 'f94132cb438d41dcdae69fe864e11e0d01a7818dc6dbd058088d0655e81ee46a'
AND (
token = 'fpLIS9pY0/pIubj4N2xvWz/6y07Hl1vinHwKpePc9hE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)