UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5C63sGGjUBzRX0Gm/6XGqFLJcPi+xm95rbak0S76qGY=' 
WHERE 
  key_id = '0f8a85ee4e8ff4859ecf852902bd75483951f686c5f103661a1bb8cd84563a27' 
  AND (
    token = '5C63sGGjUBzRX0Gm/6XGqFLJcPi+xm95rbak0S76qGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034