UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0G7aOwU2q6XLJuvHxv6mDSA6vN9u69s4AMJehkly5V8='
WHERE
key_id = '0a71b4c06eaacd6fd2987d63b34efa9a11102af99e0b93412246ba70cb543c92'
AND (
token = '0G7aOwU2q6XLJuvHxv6mDSA6vN9u69s4AMJehkly5V8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)