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