UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e6OUvMtfpxoLEli6HfUFRgKY0xUClZONCQ2ojSrZEx0='
WHERE
key_id = 'f3c5471fb503797454ba9224929fd3d9e7a8207410e7be0f07d409aaf712cfed'
AND (
token = 'e6OUvMtfpxoLEli6HfUFRgKY0xUClZONCQ2ojSrZEx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)