UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cFcm2hc93LTS+kVq04eM+L99mwpurxh9DUTfHDa6MSk='
WHERE
key_id = '245c896cfe33abcbc43f452c813c8e212b836daeb0b079261e41bd0cd986dadc'
AND (
token = 'cFcm2hc93LTS+kVq04eM+L99mwpurxh9DUTfHDa6MSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)