UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dhOucrWa97A5fXGJhkNx/eopk973QX4RmCeSwRLpeqg=' 
WHERE 
  key_id = 'be6d2bb306c73330d14ead53117d9287f53a2bce20c2841228d53dbf29b9825e' 
  AND (
    token = 'dhOucrWa97A5fXGJhkNx/eopk973QX4RmCeSwRLpeqg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040