UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5HSOa3g1fefdyaYX6dBh3WbfJFoOjojDFIFmThRGcZw='
WHERE
key_id = '09b4e1262664e05cbc75acbbd005c0720bf8e810efdcb6ff6b6e3fc8d4a9e0c0'
AND (
token = '5HSOa3g1fefdyaYX6dBh3WbfJFoOjojDFIFmThRGcZw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)