UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VJ+Dpt7XeU2pB8LNPeFM35CCRebwiz1gBWgFlBqVWRE=' 
WHERE 
  key_id = '5647f199f65d593d9268f63595e7c91137889309f71d5974425abf2944cf8342' 
  AND (
    token = 'VJ+Dpt7XeU2pB8LNPeFM35CCRebwiz1gBWgFlBqVWRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029