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

Query time 0.00039