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