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