UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fmXe0SIo13vpKrW2V12scgN+XVD80pLUcH1mN7zcHDI='
WHERE
key_id = '647bc46f45630ea8b136d19a7b23cce188bd4df9b17e0e6d32b4f88ce921dd9e'
AND (
token = 'fmXe0SIo13vpKrW2V12scgN+XVD80pLUcH1mN7zcHDI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)