UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BY5qbtiTlW4Lo4L2vXt9333RE8wrjVdgqZyDnBIYWqw='
WHERE
key_id = '7f108a3329f512444ba09d2bc15d6d483ed5b95d1575264103ca13032b09f4a3'
AND (
token = 'BY5qbtiTlW4Lo4L2vXt9333RE8wrjVdgqZyDnBIYWqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)