UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uCqkD9VWlWdd0xFMTu4SVIcMf9xfdhkdkyA+IkY7zEg='
WHERE
key_id = '1e76fa001615db45d04588165ff78a245c933a6457eb58004d0b02bda83f6ff8'
AND (
token = 'uCqkD9VWlWdd0xFMTu4SVIcMf9xfdhkdkyA+IkY7zEg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)