UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'seeoRt+6U9K+iO1MJTqW1MiBo44cte3hQjYoenq0Rs8=' 
WHERE 
  key_id = '009271cc2a42045f293a92cef5c0bd12e12f939d64880c619c804e52bb300303' 
  AND (
    token = 'seeoRt+6U9K+iO1MJTqW1MiBo44cte3hQjYoenq0Rs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016