UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CrSjlzHdh1fuoyQOennGAXtaSKLKhFSbPEOLSJS1SAg='
WHERE
key_id = '01d67d1ca98da3df91e50530653598caaf71cd1d98b6d1e3fdf780e974ccd2c9'
AND (
token = 'CrSjlzHdh1fuoyQOennGAXtaSKLKhFSbPEOLSJS1SAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)