UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0tShiK05c6evkKKoDWuWcu6HuVE6gU2npmF/obcLBIk=' 
WHERE 
  key_id = 'ed7008927ef7735cb5f6e86edcf1ca830e8cb06c5c692e2c36fedc3bc9170b2c' 
  AND (
    token = '0tShiK05c6evkKKoDWuWcu6HuVE6gU2npmF/obcLBIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025