UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WtehHA7c8IUo8io3rRAvmmno2V4vFMLr82Hk3FH9umg=' 
WHERE 
  key_id = 'b1f0d012cb55c207a00a89917757c6ef0796f3f82f76f939fb796a63404828c4' 
  AND (
    token = 'WtehHA7c8IUo8io3rRAvmmno2V4vFMLr82Hk3FH9umg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035